The present invention relates to displaying graphical image on a computer system and more particularly to a method and system for providing programmable texture processing for a graphical image.
A conventional computer graphics system can display graphical images of objects on a display. The display includes a plurality of display elements, known as pixels, typically arranged in a grid. In order to display objects, the conventional computer graphics system typically breaks each object into a plurality of polygons. A conventional system then renders the polygons in a particular order. For a three-dimensional scene, the opaque polygons are generally rendered from front to back as measured from the viewing plane of the display. Translucent polygons are desired to be rendered from back to front. Similarly, a two-dimensional scene can be displayed. In such a case, polygons are rendered based on their layer. Shallower layers occlude deeper layers.
Each of the polygon covers, or intersects, some number of the pixels in the display. Data for a portion of a polygon which intersects a particular pixel is termed the fragment for that polygon and that pixel. Thus, each polygon typically includes a number of fragments. The fragment includes data relating to the polygon at the pixel the fragment intersects. For example, the fragment typically includes information relating to color, blending modes, and texture. In order to render each fragment of a polygon, a graphics processing system must process the color and texture for the fragment.
In order to process the fragment, conventional systems interpolate the color and accumulate the color and the texture for the fragment. The texture can be thought of as another color that is typically derived from a texture map. Thus, in most conventional systems, texture and color are blended together to obtain a final color value for the fragment. In order to process the texture, a texture map is typically used. The texture map contains data relating to a variety of textures. The conventional graphics system typically looks up a desired portion of the texture. This portion of a texture typically corresponds to a pixel and is called a texel. The texel includes color and xcex1 information, but is given a different name to indicate that it came from a texture, rather than an interpolated value, such as a color, or other source. The conventional graphics system then combines the texel with interpolated colors in a texture blending unit. Texture processing is typically followed by a blend which accounts for translucency of the fragment.
More recently, multiple texture mapping has been used. Multiple texture mapping blends multiple textures for a pixel to provide the desired appearance. For example, multiple texture mapping may combine interpolated color values, such as diffuse and specular interpolated values, with a first texture representing the look of the object, another texture representing light, and a third texture depicting a reflection of another portion of the scene to add gloss to the object. Thus, each pixel in the display can have the desired appearance.
One conventional method for providing multiple texture mapping uses multiple texture blending units. Each texture blending unit is typically an arithmetic logic unit. The first texture blending unit receives as inputs a texel and the interpolated values. The texture blending unit then blends the texel with one or more of the interpolated values. This blending is typically some algebraic operation which uses the texel and one or more of the interpolated values as operands. The resultant, as well as interpolated values, is passed to the next texture blending unit. This texture blending unit also receives as an input a texel from a texture map. This texture blending unit performs an operation on some of the inputs, including the texel, and provides an output to a subsequent texture blending unit. This process continues until a final resultant is provided. Another conventional method utilizes a software renderer. If implemented in hardware, the renderer would provide a single texture blending unit. The single texture blending unit would then perform multiple blends for each fragment. The resultant of each blend except the final blend would be provided back as an input of the texture blending unit.
Although the conventional methods for performing texture blends function, there are many different ways in which textures can be blended with interpolated values. The particular values blended, as well as the mathematical function used to blend the values can change. If all of these combinations are allowed in each texture blending unit, then each texture blending unit would be relatively large and complex. Therefore, only a limited subset of the functions is typically supported by the texture blending unit. In some cases, for example where the texture blending units are cascaded, the function provided by each of the texture blending units can be fixed. Although such a texture blending unit is smaller, its functionality is limited. Different applications may utilize different operations used in texture blending. If a particular application utilizes a texture blend not supported by the texture blending units, the graphical image generated by the application will not appear as desired. Thus, a system having texture blending units which are smaller may not be able to adapt to certain applications.
Accordingly, what is needed is a system and method for providing an adaptable mechanism for providing texture processing without impacting performance of the system. The present invention addresses such a need.
A method and system for processing textures for a graphical image on a display is disclosed. The graphical image includes an object. The object includes a plurality of fragments. The method and system comprise providing a memory and providing a plurality of texture processors coupled with the memory. The memory is for storing a portion of a program for processing a plurality of texture portions for the plurality of fragments. Each of the plurality of texture processors is for processing a texture portion for a fragment in accordance with the program. The plurality of texture processors is capable of processing a portion of the plurality of texture portions in parallel.
According to the system and method disclosed herein, the present invention provides texture processing which is adaptable and may occupy a reduced amount of space without adversely impacting processing.